#include "RecentFilesView.h"
#include "RecentFilesViewObserver.h"

RecentFilesView::RecentFilesView(RecentFiles& model) :
        m_model(model)
{
}

RecentFilesView::~RecentFilesView()
{
}

void RecentFilesView::recentFileSelected(const QString& filename)
{
    // TODO: There seems to be a problem with the 'obs' - also funny how the pure virtual 'recentFileSelected' is not enforced...
    foreach(RecentFilesViewObserver *obs, m_observers)
        obs->recentFileSelected(filename);
}

void RecentFilesView::registerObserver(RecentFilesViewObserver* observer)
{
    if (!m_observers.contains(observer))
        m_observers.append(observer);
}

void RecentFilesView::unRegisterObserver(RecentFilesViewObserver* observer)
{
    m_observers.removeAll(observer);
}
